package com.bawei.jetpackdemo.dialog;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import com.bawei.jetpackdemo.R;

public class MainActivity2 extends AppCompatActivity {
    private MyDialog mMyDialog;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);

        mMyDialog = new MyDialog(this);
        mMyDialog.show();
        //注册自动感知生命周期
        getLifecycle().addObserver(mMyDialog);

    }

//    @Override
//    protected void onDestroy() {
//        super.onDestroy();
//        mMyDialog.dismiss();
//    }
}